package io.renren.modules.device.controller;

import io.renren.common.utils.R;
import io.renren.modules.device.entity.TAlarmType;
import io.renren.modules.device.entity.TDeviceCategory;
import io.renren.modules.device.service.TDeviceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.websocket.server.PathParam;
import java.util.List;

/**
 * //查询设备属性相关信息
 *
 * @author lhb
 * @date 2023/6/1
 */

@RestController
@RequestMapping("devices")
public class DeviceAttrController {

    @Autowired
    private TDeviceService deviceService;

    /**
     * 设备类型列表
     */
    @RequestMapping("category")
    public R listCategory() {
        List<TDeviceCategory> categories = deviceService.listCategories();

        return R.ok().put("data", categories);
    }
    /**
     * 设备类型列表
     */
    @RequestMapping("category/{cateId}")
    public R queryCategory(@PathVariable("cateId") String cateId) {
        TDeviceCategory categoryInfo = deviceService.categoryInfo(cateId);

        return R.ok().put("data", categoryInfo);
    }
    /**
     * 设备报警列表
     */
    @RequestMapping("alarmType")
    public R listAlarmTypes() {
        List<TAlarmType> alarmTypes = deviceService.listAlarmTypes();

        return R.ok().put("data", alarmTypes);
    }


}
